package pl.com.sthaether.mc.engine.data;

import javafx.scene.paint.Color;

import java.util.ArrayList;
import java.util.List;

public class MCCartogramColorRange {
    List<MCColorRange> cartogramColors;

    public MCCartogramColorRange() {
        this.cartogramColors = new ArrayList<>();
    }

    public Color getCartogramColor(double objectValue) {
        for (MCColorRange ran : cartogramColors) {
            if (ran.contains(objectValue)) {
                return ran.getColor();
            }
        }
        return Color.WHITE;
    }

    public List<MCColorRange> getAll() {//TODO change to copy
        return cartogramColors;
    }

    public void setAll(List<MCColorRange> items) {
        cartogramColors = new ArrayList<>(items);
    }
}
